// 题目非常巧妙, 使用^=


const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let initStr;
rl.on("line", (line)=>{
    if(initStr === undefined) {
        initStr = line.trim()
        initStr = initStr.repeat(2)
        console.log(getResult(initStr))
        // clear
        initStr = undefined
    }
})

function getResult(initStr) {
    let map = new Map()
    let state = 0
    let length = 0
    map.set(0, -1);
    for (const i in initStr) {
        let char = initStr[i]
        if(char === "l")  state ^= 1
        if(char === "o") state ^= 2
        if(char === "x") state ^= 4

        if(map.has(state)) {
            if(i - map.get(state) <= initStr.length/2 ) {
                length = Math.max(length, i - map.get(state))
            }
        } else {
            map.set(state, i)
        }
    }
    return length
}